<layout name="Layout/layout" />


<link rel="stylesheet" href="__ACE__/css/jquery-ui.custom.css" />
<link rel="stylesheet" href="__ACE__/css/chosen.css" />
<link rel="stylesheet" href="__ACE__/css/datepicker.css" />
<link rel="stylesheet" href="__ACE__/css/bootstrap-timepicker.css" />
<link rel="stylesheet" href="__ACE__/css/daterangepicker.css" />
<link rel="stylesheet" href="__ACE__/css/bootstrap-datetimepicker.css" />
<link rel="stylesheet" href="__ACE__/css/colorpicker.css" />

<form action="{:U('Admin/Member/add')}" method="post" class="form-horizontal" role="form">
    <!-- #section:elements.form -->

    <div class="form-group">
        <label class="col-sm-3 control-label no-padding-right" for="username"> 用户名 </label>

        <div class="col-sm-9">
            <input type="text" id="username" name="username" value="" placeholder="" class="col-xs-10 col-sm-5" />
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label no-padding-right" for="password"> 密码 </label>

        <div class="col-sm-9">
            <input type="password" id="password" name="password" value="" placeholder="" class="col-xs-10 col-sm-5" />
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label no-padding-right" for="cpassword"> 重复密码 </label>

        <div class="col-sm-9">
            <input type="password" id="cpassword" name="cpassword" value="" placeholder="" class="col-xs-10 col-sm-5" />
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-3 control-label no-padding-right" for="roleid"> 选择角色</label>
        <div class="col-sm-9">
            <div id="roleid">
            <?php foreach ($roleData as $k => $v): ?>
            <span style="display: inline-block;margin-right: 10px;margin-top: 8px;">
                <input name="role_id[]" value="{$v.id}" class="ace ace-checkbox-2" type="checkbox">
                <span class="lbl">{$v.role_name}</span>
            </span>
            <?php endforeach; ?>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-3 control-label no-padding-right" for="cpassword"> 是否启用 </label>

        <div class="col-sm-9">
            <label style="margin-top: 8px;">
                <input name="status" class="ace ace-switch" checked value="1" type="checkbox">
                <span class="lbl"></span>
            </label>
        </div>
    </div>


    <div class="clearfix form-actions">
        <div class="col-md-offset-3 col-md-9">
            <button class="btn btn-info" type="submit">
                <i class="ace-icon fa fa-check bigger-110"></i>
                提交
            </button>

        </div>
    </div>

</form>
<script src="__ACE__/js/ace/elements.onpage-help.js"></script>
<script>
    function check(id){
        var allprev = $(":checkbox");
        if($("#c"+id).is(':checked')){
            $(allprev).each(function(k,v){
                // 判断是不是下级的权限
                if($(v).attr("level") == id && !$(v).is(':checked'))
                {
                    $(v).click();
                }
            });
        }else{
            $(allprev).each(function(k,v){
                // 判断是不是下级的权限
                if($(v).attr("level") == id && $(v).is(':checked'))
                {
                    $(v).click();
                }
            });
        }
    }
</script>